package com.sziit.controller;

import com.sziit.service.FileService;
import org.apache.commons.fileupload.FileItem;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import java.util.List;

@RestController
public class UploadFile {

    @Autowired
    private FileService fileService;

    @RequestMapping("upload")
    public String uploadFile(HttpServletRequest request) throws Exception {

        List<FileItem> itemImgList = fileService.getFileItems(request);
        fileService.saveFile(itemImgList);

        return "success";

    }
}





